#include "junix.h"
#include <boost/functional/hash.hpp>

using namespace std;

struct A
{
	int i;
	char c;
};

inline bool operator== (const A& a, const A& b)
{
	return a.i==b.i && a.c==b.c;
}

inline bool operator != (A const& a, A const& b)
{
	return !(a==b);
}

struct A_hash:public std::unary_function<A,std::size_t>
{
	std::size_t operator()(const A& a)
	{
		std::size_t seed;
		boost::hash_combine(seed, a.i);
		boost::hash_combine(seed, a.c);
		return seed;
	}
};

int main(int argc, char **argv)
{
	A a={123,'c'};
	A b={123,'c'};

	assert(a==b);
//	assert(a!=b);

	A c={222,'Q'};
	assert(a!=c);

	A_hash hasher;
	std::cout<<hasher(a)<<std::endl;
	std::cout<<hasher(b)<<std::endl;
	std::cout<<hasher(c)<<std::endl;

}
